image_filename = '1.png'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((400,300), 0, 32)
pygame.display.set_caption("Moving Image")
img = pygame.image.load(image_filename)
x = 0
while True:
   screen.fill((255,255,255))
   for event in pygame.event.get():
      if event.type == QUIT:
         exit()
   screen.blit(img, (x, 100))
   x= x+0.01

   if x > 400:
      x = x-400
   pygame.display.update()





image_filename = '1.png'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((600,600))
pygame.display.set_caption("Moving Image")
img = pygame.image.load(image_filename)

x = 0
y = 150
while True:
   screen.fill((0,255,255))
   screen.blit(img, (x, y))
   for event in pygame.event.get():
      if event.type == QUIT:
         exit()
   if event.type == KEYDOWN:
      if event.key == K_RIGHT:
         x = x + 0.05
      if event.key == K_LEFT:
         x = x - 0.05
      if event.key == K_UP:
         y = y - 0.05
      if event.key == K_DOWN:
         y = y + 0.05
      if x > 600:
         x = x - 600
      if y > 600:
         y = y - 600
      if x < 0:
         x = x + 600
      if y  < 0:
         y = y + 600
   pygame.display.update()